<template>
  <div class="pNews">
    <div class="pNewsTop"><img :src="titleImg"></div>
    <div class="pNewsCon">
      <!--3条带有封面图的新闻数据开始-->
      <div class="newsImg">
        <ul class="pubCon clearfix"    >
          <li v-for="(item,index) in newsImgData" class="clearfix">

                <div class="imgn">
                  <img :src="item.image">
                </div>
                <p style="z-index:1000;position: absolute;">
                  <router-link tag='a' :to="{path:'/kidsworld/infoDetail',query: {infoData: item,infoId:item.id}}" >
                    {{item.title.substr(0,24)}}
                  </router-link>
                </p>
          </li>
        </ul>
        <div class="newsBg" style=""></div>
      </div>
      <!--3条带有封面图的新闻数据结束-->

      <!--10条新闻数据开始-->
      <div class="newsLi pubCon clearfix">
        <ul >
          <li  v-for="(item,index) in newsListData" v-if="index < 5" class="clearfix">
            <router-link tag='a' :to="{path:'/kidsworld/infoDetail',query: {infoData: item,infoId:item.id}}" >
              &gt;&gt;&nbsp;&nbsp;&nbsp;{{item.title}}
            </router-link>
            <span>
              {{item.timeDesc}}
            </span>
          </li>
        </ul>
        <ul >
          <li  v-for="(item,index) in newsListData" v-if="index >= 5" class="clearfix">
            <router-link tag='a' :to="{path:'/kidsworld/infoDetail',query: {infoData: item,infoId:item.id}}" >
              &gt;&gt;&nbsp;&nbsp;&nbsp;{{item.title}}
            </router-link>
            <span>
              {{item.timeDesc}}
            </span>
          </li>
        </ul>
      </div>
      <!--10条新闻数据结束-->
    </div>
  </div>
</template>
<script>
  export default {
    name: 'mwNews',
    beforeCreate() {
      var me = this;
      //请求接口获取 3条 新闻资讯数据
      me.$http.get('http://m.nsr.com.cn/xinsilu/v1/column/content/260?max=3&offset=0&type=1&siteid=1', {
        params: {}
      }).then(response => {
        if (response.data.code == 'R0000000') {
          me.newsImgData.push(...response.data.data.returnList);
        }
      }, response => {
      });
      //请求接口获取 10条 新闻资讯数据
      me.$http.get('http://m.nsr.com.cn/xinsilu/v1/column/content/260?max=10&offset=0&type=1&siteid=1', {
        params: {}
      }).then(response => {
        if (response.data.code == 'R0000000') {
          me.newsListData.push(...response.data.data.returnList);
        }
      }, response => {
      });
    },
    methods:{
      bannerClick:function(url){
        if(url) document.location.href=url;
      }
    },
    //数据
    data(){
      return {
        urlInfoDetail:'/kidsworld/infoDetail?infoId=',
        titleImg:'static/images/kwNT.png',
        newsImgData:[],//kidsworld首页-新闻中心-3条展示封面图的资讯数据
        newsListData:[]//kidsworld首页-新闻中心-10条新闻资讯数据
      }
    }
  }
</script>

<style>

</style>
